<?php 
class User_model  extends CI_Model {

	function __construct(){
        parent::__construct();
        $this->load->database();
    }
    
    public function findUser($email, $fields='*'){
    	$this->db->select($fields);
    	$this->db->from('users');
    	$this->db->where(array('email'=>$email, 'disabled'=>'false'));
    	$query = $this->db->get();
    	
    	if ($query->num_rows() > 0){
    		return $query->row_array(); 
    	}
    }
    
    public function add($data){
    	$data['ctime'] = date('Y-m-d H:i:s');
    	$this->db->insert('users', $data);
    }
}